import request from '@/utils/request'

//获取工单状态列表
export function getTaskStatus() {
  return request({
    url: `/task-service/task/allTaskStatus`,
    method: 'get',
  })
}
// 0{statusId: 1, statusName: "待办"}
// 1{statusId: 2, statusName: "进行"}
// 2{statusId: 3, statusName: "取消"}
// 3 {statusId: 4, statusName: "完成"}

//根据状态搜索工单
export function getTaskByStatus(status) {
  return request({
    url: `/task-service/task/search${status}`,
    method: 'get',
  })
}

//获取工单配置 数量 50/60/70
export function supplyAlertValue() {
  return request({
    url: `/task-service/task/supplyAlertValue`,
    method: 'get',
  })
}
//修改工单配置 数量 50/60/70
export function changeSupplyAlertValue(data) {
  return request({
    url: `/task-service/task/autoSupplyConfig`,
    method: 'post',
    data
  })
}

//获取工单类型列表
export function getTaskStyle() {
  return request({
    url: `/task-service/taskType/list`,
    method: 'get',
  })
}
// 0{typeId: 1, typeName: "投放工单", type: 1}
// 1{typeId: 2, typeName: "补货工单", type: 2}
// 2{typeId: 3, typeName: "维修工单", type: 1}
// 3{typeId: 4, typeName: "撤机工单", type: 1}

//获取工单列表
export function getTaskList(pageIndex,pageSize,taskCode,status,isRepair) {
  return request({
    url: `/task-service/task/search`,
    method: 'get',
    params: {
      pageIndex,pageSize,taskCode,status,isRepair
    }
  })
}
//获取补货清单列表
export function getChannelList(vmId) {
  return request({
    url: `/vm-service/channel/channelList/${vmId}`,
    method: 'get',
  })
}
//获取运营人员列表
export function getOperatorList(vmId) {
  return request({
    url: `/user-service/user/operatorList/${vmId}`,
    method: 'get',
  })
}


//获取工单详情
export function gettaskInfo(taskid) {
  return request({
    url: `/task-service/task/taskInfo/${taskid}`,
    method: 'get',
  })
}
//获取工单信息
export function getdetails(taskid) {
  return request({
    url: `/task-service/taskDetails/${taskid}`,
    method: 'get',
  })
}
//取消工单
export function canceltask(data,taskId) {
  return request({
    url: `/task-service/task/cancel/${taskId}`,
    method: 'post',
    data
  })
}

//重新创建

export function ReCreatetask(data) {
  return request({
    url: `/task-service/task/create`,
    method: 'post',
    data
  })
}